package com.config;

import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import redis.clients.jedis.Jedis;

@EnableAutoConfiguration
@EnableCaching
@RestController
public class RedisConfig {
	
	/**
	 * Redis Java String(字符串) 实例
	 */
	//连接本地Redis服务   
	static Jedis jedis = new Jedis("localhost");
	
	public void setUpValue() {
		System.out.println("连接成功");
		//查看服务是否运行
		System.out.println("服务正在运行"+jedis.ping());
	}
	
	//获取Redis服务
	@RequestMapping("/getUpValue")
	public synchronized String getUpValue() {
		// 从列表中取数据
		String pop = jedis.rpop("b");
		System.out.println(pop);
		return pop;
	}
	
	
}
